package com.mxpio.erp.common.plm.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpio.erp.common.jpa.policy.ResCodeGeneratorPolicy;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import com.mxpioframework.security.entity.Dept;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 项目风险列表
 * @author qb
 * @date 2024-2-21
 */
@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_PLM_PROJECT_DANGER")
@Schema(description="项目风险列表")
public class ProjectDanger extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @Id
    @Column(name = "DANGER_CODE_")
    @Schema(description="风险编码")
    @Generator(policy = ResCodeGeneratorPolicy.class)
    private String dangerCode;

    @Column(name = "DANGER_NAME_")
    @Schema(description="风险名称")
    private String dangerName;

    @Column(name = "DANGER_STATUS_")
    @Schema(description="风险状态")
    @Dict(dicCode ="ERP_PLM_PROJECT_DANGER_STATUS" )
    private String dangerStatus;

    @Column(name = "PROCESSING_")
    @Schema(description="处理方式")
    @Dict(dicCode ="ERP_PLM_PROJECT_DANGER_PROCESSING" )
    private String processing;

    @Column(name = "PROCESSING_DESC_",columnDefinition="TEXT")
    @Schema(description = "处理描述")
    private  String processingDesc;

    @Column(name = "PRO_CODE_")
    @Schema(description = "项目编码")
    private String proCode;

    @Column(name = "PRO_NAME_")
    @Schema(description = "项目名称")
    private String proName;

    @Column(name = "DANGER_TYPE_")
    @Schema(description="风险类型")
    @Dict(dicCode ="ERP_PLM_PROJECT_DANGER_TYPE" )
    private String dangerType;

    @Column(name = "DANGER_LEVEL_")
    @Schema(description="风险等级")
    @Dict(dicCode ="ERP_PLM_PROJECT_DANGER_LEVEL")
    private String dangerLevel;

    @Column(name = "DANGER_DESC_",columnDefinition="TEXT")
    @Schema(description="风险描述")
    private String dangerDesc;

    @Column(name = "DEGREE_OF_IMPACT_")
    @Schema(description="影响程度")
    @Dict(dicCode ="ERP_PLM_PROJECT_DANGER_IMPACT")
    private String degreeOfImpact;

    @Column(name = "FIND_USER_")
    @Schema(description="发现人")
    @Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
    private String findUser;

    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Column(name = "FIND_TIME_")
    @Schema(description="发现时间")
    private Date findTime;

    @Column(name = "DEPARTMENT_")
    @Schema(description="责任部门")
    @Dict(dicCode = "deptCode", dicEntity = Dept.class, dicText = "deptName")
    private String department;

    @Column(name = "PROBABILITY_")
    @Schema(description="发生概率%")
    private BigDecimal probability;


}
